package com.axdoc.walletbiz.record.mq.service.impl;

import java.math.BigDecimal;
import java.util.Iterator;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.axdoc.walletbiz.record.mq.message.Message;
import com.axdoc.walletbiz.record.mq.message.TransactionDoneMessage;
import com.axdoc.walletbiz.record.mq.service.MsgService;
import com.axdoc.walletbiz.record.service.RecordService;

/**
 * 交易完成消息
 * 
 * @author sunzhaoli
 *
 */
@Component("transactionDoneService")
public class TransactionDoneServiceImpl implements MsgService {
	public static Logger logger = LoggerFactory.getLogger("listen_message");

	@Autowired
	private RecordService recordService;

	@Override
	public void handle(Message msg) {
		try {
			TransactionDoneMessage message = (TransactionDoneMessage) msg;
			logger.info("[处理交易完成消息,req,msg:" + message + " ]");
			recordService.transactionDone(message);
		} catch (Exception e) {
			logger.error("[处理交易完成消息异常,error,msg:" + msg, e);
		}
	}
}
